-- FETCH_TAVERN_GOODS

-- 海盗酒馆
-- @param user 玩家对象
return function(user)
    local count = DungeonShopM.queryShopRule("tavern", "total_count");
    local ret = {};

    -- 商品数量加
    local prop = PropM.combine(user, "shop_num", "tavern");
    count = count + PropM.apply(prop, 1);

    -- 获得海怪船长前，无尽关卡固定抽取商品烧烤鱿鱼；获得后正常抽取
    local goods   = DungeonShopM.getGoodsByType("tavern");
    local goods_1 = DungeonShopM.getGoodsByType("tavern_1");
    local dungeonId = DungeonM.getDungeonId();
    if PetM.getMyPet(76) or not DungeonAreaM.isEndlessArea(dungeonId) then
        goods = table.append(goods, goods_1);
    else
        for _, data in ipairs(goods_1) do
            table.insert(ret, { ["goodsId"] = data["id"], });
            count = count - 1;
        end
    end

    local filterArr = {};
    local good;
    local rand;
    for i = 1, count do
        rand = DungeonM.getRandSeed("shop");

        -- 抽取到一个商品
        good = DungeonShopM.fetchByRand(goods, rand, filterArr);
        ret = table.append(ret, good);

        for _, data in pairs(good) do
            if DungeonShopM.query(data.goodsId, "unrepeat") == 1 then
                -- 避免抽取一样的
                table.insert(filterArr, data.goodsId);
            end
        end
    end

    return ret;
end
